<html>

<head>
<meta charset="UTF-8">
<title>添加用户</title>
</head>
<body>
	<link rel="stylesheet" type="text/css" href="/css/form.css">
	<script type="text/javascript" src="/js/user_manage.js"></script>
	<script type="text/javascript">
		$(".navigation span:first").text("用户管理");
	</script>
	<#include "/head.ftl"/>
	<div class="content">
		<div class="tab">
			<div class="tab-header">
				<a title="返回" class="btn btn-setting" onclick="back(this)">
					<i class="iconfont icon-undo"></i>
				</a> <a title="刷新" class="btn btn-setting" onclick="refresh(this)">
					<i class="iconfont icon-refresh"></i>
				</a> 
			</div>
			<div class="form-content">
				<form method="post" id="userForm" enctype="multipart/form-data">
					<fieldset class="info1">
						<legend>基本信息</legend>
						<table>
							<tr>
								<td>真实姓名：</td>
								<td><input type="text" name="realName" placeholder="请输入真实姓名" maxlength="10" value="${(user.realName)?default('')}"></td>
								<td>身份证号：</td>
								<td><input type="text" name="identity" placeholder="请输入15位或18位数字" maxlength="20" value="${(user.identity)?default('')}"></td>
								<td style="text-align: center;" rowspan="5">
									<#if user?? && user.photo!=''>
										<img src=/file/image/${user.photo} id="head" width="150px" height="200px" style="border:1px solid #eee;margin:20px 0;">
									<#else>
										<img id="head" width="150px" height="200px" style="border:1px solid rgba(0, 166, 90, 0.5);margin:20px 0;">
									</#if>
								</td>
							</tr>
							<tr>
								<td>用户名：</td>
								<td><input type="text" name="name" placeholder="输入用户名不超过10位"  maxlength="10" value="${(user.name)?default('')}"></td>
								<td>密码：</td>
								<td>
									<div class="hidePwd pwd">
										<input type="password" name="password" placeholder="密码长度在6-12位之间" onkeyup="copyPwd(this)" maxlength="20" value="${(user.password)?default('123456')}">
										<a class="eye" onclick="changeEye(this)"><i class="iconfont icon-eye"></i></a>
									</div>
									<div class="showPwd pwd">
										<input type="text" name="passwordText" placeholder="密码长度在6-12位之间" onkeyup="copyPwd(this)" maxlength="20" value="${(user.password)?default('123456')}">
										<a class="eye" onclick="changeEye(this)"><i class="iconfont icon-eye-close"></i></a>
									</div>
								</td>
							</tr>
							<tr>
								<td>性别：</td>
								<td colspan="3" style="text-align: left;">
									<#if user?? && user.sex=='男'>
										<input type="radio" name="sex" value="1" checked="checked">男
										<input type="radio" name="sex" value="0">女
									<#elseif user?? && user.sex=='女'>
										<input type="radio" name="sex" value="1">男
										<input type="radio" name="sex" value="0" checked="checked">女
									<#else>
										<input type="radio" name="sex" value="1" checked="checked">男
										<input type="radio" name="sex" value="0">女
									</#if>
								</td>

							</tr>
							<tr>
								<td>手机号码：</td>
								<td><input type="text" name="tel" placeholder="请输入11位号码" value="${(user.tel)?default('')}"></td>
								<td>出生日期：</td>
								<td><input type="text" name="bir" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true})" value="${(user.bir)?default('1990-01-01')}"></td>
							</tr>
							<tr>
								<td>银行卡号：</td>
								<td colspan="3"><input name="bank" type="text" value="${(user.bank)?default('')}" onkeyup="this.value=this.value.replace(/[^\d]/g,'') " onafterpaste="this.value=this.value.replace(/[^\d]/g,'')"></td>
							</tr>
							<tr>
								<td>家庭住址：</td>
								<td colspan="3"><input name="address" type="text" value="${(user.address)?default('')}"></td>
								<td style="text-align: center;">
									<a class="upload" onclick="file.click()">选择头像</a>
									<input id="file" name="file" type="file" onchange="showPic(this)">
								</td>
							</tr>
							<tr>
								<td style="text-align: center;" colspan="5"><a class="button bgColor-green2" onclick="baseInfoNext(this)">下一步</a></td>
							</tr>
						</table>
					</fieldset>
					<fieldset class="info2">
						<legend>选择职位</legend>
						<table>
							<tr>
								<td>所在部门：</td>
								<td>
									<select name="dept" onchange="changeOffice(this)">
										<option value="">-选择部门-</option>
										<#list dept as dept>
											<#if user?? && dept.id==user.dept.id>
												<option value="${dept.id}" selected="selected">${dept.name}</option>
												<#else>
												<option value="${dept.id}">${dept.name}</option>
											</#if>
										</#list>
									</select>
								</td>
							</tr>
							<tr>
								<td>所属职位：</td>
								<td>
									<select name="deptOffice">
										<option value="">-选择职位-</option>
										<#if office??>
											<#list office as office>
												<#if office.id==user.deptOffice.id>
													<option value="${office.id}" selected="selected">${office.name}</option>
													<#else>
													<option value="${office.id}">${office.name}</option>
												</#if>
											</#list>
										</#if>
									</select>
								</td>
							</tr>
							<tr>
								<td>就职日期：</td>
								<td><input type="text" name="hiredate" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true})"  value="${(user.hiredate)?default(.now?date)}" ></td>
							</tr>
							<tr>
								<td>基本工资：</td>
								<td><input type="text" name="sal" placeholder="最多保留两位小数"  value="${(user.sal?replace(',',''))?default('')}"></td>
							</tr>
							<tr>
								<td style="text-align: center;" colspan="2"><a class="lastStep button" onclick="skitInfo(1,this)">上一步</a><a class="button bgColor-green2" onclick="DeptInfoNext(this)">下一步</a></td>
							</tr>
						</table>
					</fieldset>
					<fieldset class="info3">
						<legend>更多信息</legend>
						<table>
							<tr>
								<td>邮箱账号：</td>
								<td><input type="text" name="email" placeholder="格式：bilibili@xx.com" value="${(user.email)?default('')}"></td>
							</tr>
							<!-- <tr>
								<td>家庭住址：</td>
								<td><input type="text" name="address" placeholder="请输入省、市（区）、县、镇、村"></td>
							</tr> -->
							<tr>
								<td>学历：</td>
								<td>
									<#assign education=['无','小学','初中','高中','大专','本科','硕士','博士','博士后']>
									<select name="education">
										<#list education as edu>
											<#if user?? && user.education==edu>
												<option value="${edu}" selected="selected">${edu}</option>
												<#else>
												<option value="${edu}">${edu}</option>
											</#if>
										</#list>
									</select>
								</td>
							</tr>
							<tr>
								<td>毕业院校：</td>
								<td><input type="text" name="graduationSchool" value="${(user.graduationSchool)?default('')}"></td>
							</tr>
							<tr>
								<td>用户角色：</td>
								<td>
									<#list roles as role>
										<label>${role.name}</label>
										<#assign flag=0>
										<#if user??>
											<#list user.roles as urole>
												<#if urole.id==role.id>
													<input type="checkbox" name="roles" value="${role.id}" checked="checked">
													<#assign flag=1>
													<#break>
												</#if>
											</#list>
										</#if>
										<#if flag==0>
											<input type="checkbox" name="roles" value="${role.id}">
										</#if>
									</#list>
								</td>
							</tr>
							<tr>
								<td style="text-align: center;" colspan="2">
									<a class="lastStep button" onclick="skitInfo(2,this)">上一步</a>
									<input type="hidden" name="id" value="${(user.id)?default('')}">
									<input type="hidden" name="photo" value="${(user.photo)?default('')}">
									<input class="button bgColor-green2"style="padding: 11px 40px;" type="submit" value="保存">
								</td>
							</tr>
						</table>
					</fieldset>
				</form>
			</div>
		</div>

	</div>
</body>
</html>